package com.netty.learn.pio;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import com.netty.learn.bio.TimeServerHandler;

public class TimeServer {
	
	public static void main(String[] args) {
		int port = 8080;
		
		ServerSocket server = null;
		try {
			server = new ServerSocket(port);
			System.out.println("The time server is start in port : " + port);
			Socket socket = null;
			TimeServerHandlerExecutePool singleExcutor = new TimeServerHandlerExecutePool(50, 10000);
			while(true) {
				socket = server.accept();
				singleExcutor.execute(new TimeServerHandler(socket));
			}
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
